package testclock;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import clock.bean.ClockBean;

public class CadrePrincipal extends JFrame
{
    private JPanel contentPane;
    private ClockBean clockBean = new ClockBean();

    Thread threadClock;
    //Construire le cadre
    public CadrePrincipal()
    {
	enableEvents(AWTEvent.WINDOW_EVENT_MASK);
	try
	{
	    jbInit();
	}
	catch(Exception e)
	{
	    e.printStackTrace();
	}
	//clockBean.start();
    }


    //Initialiser le composant
    private void jbInit() throws Exception
    {
	//setIconImage(Toolkit.getDefaultToolkit().createImage(CadrePrincipal.class.getResource("[Votre icône]")));
	contentPane = (JPanel) this.getContentPane();
	contentPane.setLayout(null);
	this.getContentPane().setBackground(new Color(212, 208, 200));
	//this.setSize(new Dimension(323, 285));
	this.setTitle("Test Clock");
	clockBean.setBackground(new Color(182, 192, 172));
	clockBean.setDoubleBuffered(false);
	clockBean.setOpaque(false);
	clockBean.setToolTipText("Horloge");
	clockBean.setHHandColor(new Color(90, 195, 90));
	clockBean.setMHandColor(new Color(90, 195, 90));
	clockBean.setSHandColor(Color.red);
	clockBean.setHPointColor(new Color(140, 255, 140));
	clockBean.setBackImage("");
	clockBean.setHourChime(true);
	clockBean.setHalfHourChime(true);
	clockBean.setBounds(new Rectangle(5, 2, 117, 112));
	clockBean.setFontText(new java.awt.Font("Dialog", 0, 18));
	contentPane.setBackground(SystemColor.control);
	contentPane.setPreferredSize(new Dimension(130, 130));
	contentPane.add(clockBean, null);
    }

    //Supplanté, ainsi nous pouvons sortir quand la fenêtre est fermée
    protected void processWindowEvent(WindowEvent e) {
	super.processWindowEvent(e);
	if (e.getID() == WindowEvent.WINDOW_CLOSING) {
	    System.exit(0);
	}
    }



}